<?php
/**
 * @file
 * Header file for deed.
 *
 * Usage:
 *  - A page that wants to work with deeds should include/require this page once
 *    and only once.
 *
 * Parameter(s):
 *  - $PATH_COMMON : Relative path from the calling page to the 'common'
 *                   directory (e.g. '../common/').
 *
 * Global variable(s) set:
 *  - None.
 *
 * Global variable(s) unset:
 *  - None.
 *
 * Exception(s):
 *  - None.
 *
 * This file includes/requires:
 *  - h_facebook.php
 */

// header file(s) ==============================================================
require_once $PATH_COMMON . "php/h_facebook.php";


// constant(s) =================================================================
// general ---------------------------------------------------------------------
define("ID_VIEW_DIV", "deed_div");  //!< View deed DIV ID.

// message(s) ------------------------------------------------------------------
// error message(s)
//! Error message DIV ID (view/delete).
define("ID_VIEW_ERR_DIV" , "div_view_err");
//! Error message SPAN ID (view/delete).
define("ID_VIEW_ERR_MSG" , "msg_view_err");
//! Error message DIV ID (add).
define("ID_ADD_ERR_DIV" , "div_add_err");
//! Error message SPAN ID (add).
define("ID_ADD_ERR_MSG" , "msg_add_err");
// info message(s)
//! Info message DIV ID (view/delete).
define("ID_VIEW_INFO_DIV", "div_view_info");
//! Info message SPAN ID (view/delete).
define("ID_VIEW_INFO_MSG" , "msg_view_info");
//! Info message DIV ID (add).
define("ID_ADD_INFO_DIV", "div_add_info");
//! Info message SPAN ID (add).
define("ID_ADD_INFO_MSG" , "msg_add_info");

// view ------------------------------------------------------------------------
// table(s)
//! View deed row (tr) ID prefix.
define("ID_VIEW_TR_PREFIX", "deed_row_");
// deed statement
//! Open tag for link HTML.
define("HTML_LINK_OP", "<a href='<%url%>' target='_top'>");
//! Close tag for link HTML.
define("HTML_LINK_CL", "</a>");
//! Placeholder for link HTML.
define("HTML_LINK_SEARCH", "<%url%>");
//! HTML formating for user info.
define(
  "HTML_USER_INFO",
  "<%link_op%>
    <img src='<%src%>' border='0' align='left'/>
   <%link_cl%>
   <%link_op%><%name%><%link_cl%>"
);
//! Array of placeholders for HTML formating for user info.
$HTML_USER_INFO_SEARCH = array(
  "<%link_op%>", "<%link_cl%>", "<%src%>", "<%name%>"
);
//! Location of silhouette image.
define(
  "IMG_THUMBNAIL_SILHOUETTE",
  "http://static.ak.fbcdn.net/pics/t_silhouette.gif"
);

// view & add ------------------------------------------------------------------
define("DELIMITER_DEED_STATEMENT", "`");  //!< Delimeter for deed statements.

// delete ----------------------------------------------------------------------
// form
//! Deed ID field.
define("ID_FIELD_ID_DEED" , "deed_id");
// button(s)
//! CSS class for 'delete' button.
define("CSS_CLASS_BUTTON_DELETE", "ButtonDelete");
// logic
//! Position of status flag in response message.
define("DEED_DELETE_POS_FLAG", 0);
//! Position of deed id in response message.
define("DEED_DELETE_POS_DEED_ID", 1);
//! Position of error message in response message.
define("DEED_DELETE_POS_ERROR_MSG", 1);

// delete & add ----------------------------------------------------------------
//! Delimiter used in the action response message
define("DELIMITER_DEED_ACTION_RESPONSE", "|");
//! Flag to indicate successful action.
define("DEED_ACTION_OK", BIT_SET);
//! Flag to indicate action failed.
define("DEED_ACTION_KO", BIT_CLR);

// add -------------------------------------------------------------------------
// tab(s)
//! Tabs DIV ID.
define("ID_DIV_TABS", "tabs_add");
//! Style for tab content.
define("STYLE_FONTSIZE_TAB_CONTENT", "font-size: 0.909em");
// form
//! Name of deed input form.
define("NAME_DEED_ADD_FORM_PREFIX", "form_deed_add_");
//! Name of deed input field.
define("NAME_DEED_ADD_INPUT", "field_deed_input");
//! Name of deed type id field.
define("NAME_DEED_ADD_TYPE_ID", "field_deed_type_id");
//! Name of publishing checkbox.
define("NAME_DEED_ADD_PUBLISH", "field_deed_publish");
//! Name of deed statement place holders field.
define("NAME_DEED_ADD_STATEMENT_SEARCH", "field_deed_statement_search");
//! Name of deed statement field
define("NAME_DEED_ADD_STATEMENT", "field_deed_statement");
// button(s)
//! CSS class for 'add' button.
define("CSS_CLASS_BUTTON_ADD", "ButtonAdd");
// logic
//! Maximum length of deed statement.
define("DEED_STATEMENT_LENGTH_MAX", 512);
//! Length of deed statement delimiter.
define("DEED_STATEMENT_LENGTH_DELIMITER", 1);
//! Maximum length of user input part of deed statement
define(
  "DEED_INPUT_LENGTH_MAX",
  DEED_STATEMENT_LENGTH_MAX
  - FB_LENGTH_USER_ID               // } reserve space for user id part of deed
  - DEED_STATEMENT_LENGTH_DELIMITER // } statement
);
//! Position of status flag in response message.
define("DEED_ADD_POS_FLAG", 0);
//! Position of error message in response message.
define("DEED_ADD_POS_ERROR_MSG", 1);
?>
